home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 051-075 / scopedisk70 / magus110 / magus!util.rexx < prev    next >
OS/2 REXX Batch file  |  1995-03-19  |  4KB  |  121 lines

  1. /*---------------------------- Start REXX Source ----------------------------*/
  2.  
  3. /*    Magus!Util.rexx          Revised 15-APR-89
  4.  
  5.     Magus! Print Spooler
  6.            v1.10               Associated files: Magus!.rexx
  7.                                                  Magus!Cntl.rexx
  8.             by                                   MPrint.rexx
  9.         Dan Schenck                              MPrintIt.rexx
  10.          Tulsa, OK
  11.  
  12.       GEnie: D.SCHENCK
  13.        (918) 492-0523
  14.                          */
  15.  
  16. /*  Requires rexxarplib.library v2.1 */
  17.  
  18. arg task .
  19.  
  20. true = 1
  21. false = 0
  22. done = false
  23.  
  24. select
  25.   when (task = "ABORTJOB") | (task = "LISTQ") then
  26.     do until(done)
  27.       if GetEnv('printit_pgm') = 'ACTIVE' then
  28.         do
  29.           call writech(STDOUT,'9B'x || '1;1H' || '9B'x || '2J')
  30.           say ' '
  31.           say 'ARexx Print Spooler Queue'
  32.           say ' '
  33.           do while(GetEnv('prnt_spooler') = 'GETTINGCLIP')
  34.             call delay(25)
  35.           end
  36.           rtn = SetEnv('prnt_spooler','GETTINGCLIP')
  37.           current_pointer = GetEnv('current_print')
  38.           fwrd_pointer = current_pointer
  39.           status = 'Active'
  40.           pct_read = trunc(nint(GetEnv('%_read')+.5))
  41.           if pct_read < 10 then pct_read = " "||pct_read
  42.           i = 0
  43.           say "#  Status %   Copies  File"
  44.           do while((fwrd_pointer ~= 'null') & (fwrd_pointer ~= ""))
  45.             i = i + 1
  46.             file_no.i = i
  47.             instring = GetEnv(fwrd_pointer)
  48.             pointer.i = fwrd_pointer
  49.             file_name.i = word(instring,2)
  50.             call writeln(STDOUT,i || '.' status pct_read '  ' word(instring,4) '   ' word(instring,3))
  51.             fwrd_pointer = word(instring,1)
  52.             next.i = fwrd_pointer
  53.             status = 'Queued'
  54.             pct_read = "--"
  55.           end
  56.           rtn = SetEnv('prnt_spooler',"NA")
  57.           say ' '
  58.           max = i
  59.           if (task = "ABORTJOB" & max > 0) then
  60.             do
  61.               say 'Enter number of each file to ABORT separated by a space:'
  62.               pull files2kill
  63.               kill = 1
  64.               i = word(files2kill,kill)
  65.               rtn = SetEnv('prnt_spooler','GETTINGCLIP')
  66.               do while(i ~= "" & file_no.i = i)
  67.               if pointer.i = current_pointer then rtn = SetEnv('printit_pgm','ABORT')
  68.                 else
  69.                   do
  70.                     j = i - 1
  71.                     if i = max then rtn = SetEnv('spool_tail',GetEnv('spool_tail') - 1)
  72.                     instring = GetEnv(pointer.j)
  73.                     rtn = SetEnv(pointer.j,next.i subword(instring,2))
  74.                     rtn = SetEnv(pointer.i,"null")
  75.                     if (index(upper(file_name.i),"++M!SPOOL/++") > 0) then
  76.                       address command 'delete' file_name.i || " Quiet"
  77.                   end
  78.                 file_no.i = -i
  79.                 kill = kill + 1
  80.                 i = word(files2kill,kill)
  81.               end
  82.               task = "LISTQ"
  83.             end
  84.           else
  85.             do i = 1 to 1
  86.               call writech(STDOUT,'Enter:  "L" to relist queue; "A" to abort job; "Q" to quit. - ')
  87.               do until(key = "L" | key = "A" | key = "Q")
  88.                 key = readln(STDIN)
  89.                 key = upper(key)
  90.               end
  91.               select
  92.                 when key = "L" then leave i
  93.                 when key = "A" then
  94.                   do
  95.                     task = "ABORTJOB"
  96.                     leave i
  97.                   end
  98.                 when key = "Q" then done = true
  99.                 otherwise done = true
  100.                 end
  101.             end
  102.           rtn = SetEnv('prnt_spooler',"NA")
  103.         end
  104.       else
  105.         do
  106.           say 'No Files In Print Queue'
  107.           call Delay(200)
  108.           done = true
  109.         end
  110.     end
  111.   otherwise
  112.     do
  113.       say 'Invalid operation "' || task || '" requested.'
  114.       call Delay(150)
  115.       done = true
  116.     end
  117. end
  118. exit(0)
  119.  
  120. /*----------------------------- End REXX Source -----------------------------*/
  121.